<?php 
$this->load->model('lookup_model');
$this->load->library('form_validation');
$gametype = $this->lookup_model->list_lookup(1);
?>
<div class="container">
	<div class="module mod-line-top">
	<?=validation_errors('<div class="alert alert-danger">', '</div>'); ?>
	<?php
	if(isset($errors) && $errors){
		echo '<div class="alert alert-danger">'.$errors.'</div>';
	}
	if(isset($success) && $success){
		echo '<div class="alert alert-success">'.$success.'</div>';
	}
	if(isset($upload) && isset($upload['msg']) && $upload['msg'] != 'success'){
		echo '<div class="alert alert-danger">'.$upload['msg'].'</div>';
	}
	?>
	
	
	<form id="home-form" name="home-form" action="<?=site_url('bill/addbill')?>" method="post" enctype="multipart/form-data">
		<h2>填写充值内容</h2>
		<div class="row">
			<div class="form-group col-lg-6">
				<label>游戏账号</label>
				<input class="form-control" maxlength="10" name="account_no" id="account_no" type="text" value="<?=set_value('account_no')?>">	
			</div>
			<div class="form-group col-lg-6">
				<label>游戏名称</label>
				<select class="form-control" id="account_type" name="account_type" onchange="changegame(this)">
		    		<option></option>
		    		<?php foreach ($gametype as $gametype_item): ?>
						<option value="<?=$gametype_item['l_code'] ?>"<?=set_value('account_type')==$gametype_item['l_code']?' selected':''?>><?=$gametype_item['l_value'] ?></option>
					<?php endforeach ?>
					<option value='others' <?=set_value('account_type')=='others'?' selected':''?>>其他</option>
		    	</select>
		    	<br>
		    	<input type="text" id="others" name="others" class="form-control" type="text" value="<?=set_value('others')?>" style="display:<?=set_value('account_type') == 'others'?'inline':'none'?>">
			</div>
			<div class="form-group col-lg-6">
				<label for="sg_money">汇率</label>
				<input type="text" id="rate" name="rate" class="form-control" value="<?= $this->session->userdata['currency']['value']?>" disabled>
				<p class="help-block">
				<?$t = $this->session->userdata['currency']['time'];?>
				时间: <?=($t['mday'] . '/' . $t['mon'] . '/' . $t['year'])?> <?=$t['hours'] . ':' . $t['minutes']?>
				</p>
			</div>
			<div class="form-group col-lg-6">
				<label for="sg_money">充值金额</label>
				<input type="text" id="sg_money" name="sg_money" class="form-control" value="<?=set_value('sg_money')?>">
			</div>
			<div class="form-group col-lg-6">
				<label for="receipt1">银行转账收据</label>
				<input type="file" id="receipt1" name="receipt1" class="form-control">
			    <p class="help-block">说明</p>
			</div>
			
		</div>
		<div class="form-actions">
			<button type="submit" class="btn btn-primary">确定</button>
	  		<button type="reset" class="btn btn-default">重置</button>
		</div>
	</form>
	</div>
</div>

<script>
function changegame(obj){
	obj.value == 'others'?$('#others').show():$('#others').hide();
}
</script>

